# *-*- coding:utf-8 -*-
# @Author  : Eliza
# @Time    : 2021/7/18 1:20
# @Software : RubyMine

=begin
  each
  times
  step
=end
array = [1, 2, 3, "A", true]
array.each { |value|
  puts value
}
puts "---------------"
array.each do |value|
  puts value
end
puts "---------------"
array.each_with_index do |value, index|
  puts index.to_s + ":" + value.to_s
end
puts "-------# times--------"
5.times do |i|
  puts "第#{i + 1}次times循环"
end

puts "------#step循环--------"
# end ,step
1.step(10, 3) do |i|
  puts "#{i}"
end
puts "--upto---"
2.upto(5) do |i|
  puts "updo=" + i.to_s
end
puts "--#downto---"

5.downto(2) do |i|
  puts "downto=" + i.to_s
end
